package io.renren.modules.member.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.renren.modules.member.entity.StandardBmiEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface StandardBmiDao extends BaseMapper<StandardBmiEntity> {

    @Select("SELECT " + StandardBmiEntity.SQL_COLUMN + " FROM standard_bmi t WHERE t.sex = #{sex} AND t.min_age <= #{age} AND t.max_age >= #{age} LIMIT 1 ")
    StandardBmiEntity findBySexAndAge(@Param("sex") String sex, @Param("age") Integer age);
}
